{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "94199d23",
   "metadata": {},
   "source": [
    "## jupyter notebok 扩展\n",
    "\n",
    "https://zhuanlan.zhihu.com/p/97394628\n",
    "\n",
    "## 初识地图\n",
    "1. 地图API简介（Web服务）\n",
    "2. 如何选择合适的API（开发支持）\n",
    "![API_type](API_type.png)\n",
    "3. 权衡经济成本和产品设计成本（调用量和并发量思考，经济成本考量）\n",
    "4. 设计地图url需求\n",
    "5. 测试API功能\n",
    "\n",
    "![API_value](API_value.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "baf08991",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 3.web服务api简介\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "356ae57b",
   "metadata": {},
   "source": [
    "## 3. Web服务API简介 \n",
    "* 高德Web服务API向开发者提供HTTP接口，开发者可通过这些接口使用各类型的地理数据服务，返回结果支持JSON和XML格式。Web服务API对所有用户开放。使用本组服务之前，需要申请应用Key。不同类型用户可获取不同的数据访问能力。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c8db7bf6",
   "metadata": {},
   "source": [
    "### 3.1地理/逆地理编码\n",
    "* 结构化地址：\n",
    "> 首先，地址肯定是一串字符，内含国家、省份、城市、区县、城镇、乡村、街道、门牌号码、屋邨、大厦等建筑物名称。按照由大区域名称到小区域名称组合在一起的字符。一个有效的地址应该是独一无二的。注意：针对大陆、港、澳地区的地理编码转换时可以将国家信息选择性的忽略，但省、市、城镇等级别的地址构成是不能忽略的。暂时不支持返回台湾省的详细地址信息。\n",
    "* 结构化地址<--->经纬度：\n",
    "> 地理编码/逆地理编码 API 是通过 HTTP/HTTPS 协议访问远程服务的接口，提供结构化地址与经纬度之间的相互转化的能力。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4f602720",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：https://restapi.amap.com/v3/geocode/geo?parameters\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/geo?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'address' : '广东省广州市从化区温泉镇温泉大道882号'\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "# params --> 请求的参数\n",
    "r = requests.get(url=geo_url,params=payload)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "910afce2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0d0d8bd8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'geocodes': [{'formatted_address': '广东省广州市从化区温泉镇温泉大道882号',\n",
       "   'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'citycode': '020',\n",
       "   'city': '广州市',\n",
       "   'district': '从化区',\n",
       "   'township': [],\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'adcode': '440117',\n",
       "   'street': '温泉大道',\n",
       "   'number': '882号',\n",
       "   'location': '113.671505,23.643685',\n",
       "   'level': '门牌号'}]}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1e0d3c50",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.671505,23.643685'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "广州南方学院_location = r.json()['geocodes'][0]['location']\n",
    "广州南方学院_location"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ed6885da",
   "metadata": {},
   "source": [
    "### 3.2 逆地理编码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "cc8d2315",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：https://restapi.amap.com/v3/geocode/geo?parameters\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/regeo?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'location' : 广州南方学院_location\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "r = requests.get(url=geo_url,params=payload)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c4e394bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "19f783a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'regeocode': {'addressComponent': {'city': '广州市',\n",
       "   'province': '广东省',\n",
       "   'adcode': '440117',\n",
       "   'district': '从化区',\n",
       "   'towncode': '440117100000',\n",
       "   'streetNumber': {'number': '882号',\n",
       "    'location': '113.671505,23.643685',\n",
       "    'direction': 'Center',\n",
       "    'distance': '0',\n",
       "    'street': '温泉大道'},\n",
       "   'country': '中国',\n",
       "   'township': '温泉镇',\n",
       "   'businessAreas': [{'location': '113.648930,23.636205',\n",
       "     'name': '温泉',\n",
       "     'id': '440117'}],\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'citycode': '020'},\n",
       "  'formatted_address': '广东省广州市从化区温泉镇温泉大道882号'},\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "cdbbba2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# extensions =all\n",
    "# 1. 调用requests模块（谷歌浏览器）\n",
    "import requests\n",
    "\n",
    "# 2.请求方法：Get\n",
    "\n",
    "# 3.url地址：https://restapi.amap.com/v3/geocode/geo?parameters\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/regeo?parameters\"\n",
    "\n",
    "# 4.准备参数，用于交换数据[payload]\n",
    "payload = {\n",
    "    'key' : 'a100a0fe3fbe830ec11430470e8809b0',\n",
    "    'location' : 广州南方学院_location,\n",
    "    \"extensions\":'all',\n",
    "    \"poitype\":\"True\"\n",
    "}\n",
    "\n",
    "# 5. 发起请求 酬载\n",
    "r = requests.get(url=geo_url,params=payload)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "645acac0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "6f362d44",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'regeocode': {'formatted_address': '广东省广州市从化区温泉镇温泉大道882号',\n",
       "  'addressComponent': {'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'city': '广州市',\n",
       "   'citycode': '020',\n",
       "   'district': '从化区',\n",
       "   'adcode': '440117',\n",
       "   'township': '温泉镇',\n",
       "   'towncode': '440117100000',\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'streetNumber': {'street': '温泉大道',\n",
       "    'number': '882号',\n",
       "    'location': '113.671505,23.643685',\n",
       "    'direction': 'Center',\n",
       "    'distance': '0'},\n",
       "   'businessAreas': [{'location': '113.648930,23.636205',\n",
       "     'name': '温泉',\n",
       "     'id': '440117'}]},\n",
       "  'pois': [{'id': 'B0I6BUT5PX',\n",
       "    'name': '顺通驾校',\n",
       "    'type': '科教文化服务;驾校;驾校',\n",
       "    'tel': [],\n",
       "    'direction': '东',\n",
       "    'distance': '229.992',\n",
       "    'location': '113.673591,23.644476',\n",
       "    'address': '温泉大道888号',\n",
       "    'poiweight': '0.183876',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFIXZM0P',\n",
       "    'name': '从化温泉竹园农庄(温泉镇店)',\n",
       "    'type': '餐饮服务;中餐厅;中餐厅',\n",
       "    'tel': '13650895671',\n",
       "    'direction': '东北',\n",
       "    'distance': '226.766',\n",
       "    'location': '113.672914,23.645264',\n",
       "    'address': '温泉镇卫东村105国道旁广州南方学院斜对面',\n",
       "    'poiweight': '0.205309',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFG6A3H6',\n",
       "    'name': '中石油冠力金叶加油站',\n",
       "    'type': '汽车服务;加油站;中国石油',\n",
       "    'tel': '020-87830698',\n",
       "    'direction': '东北',\n",
       "    'distance': '273.921',\n",
       "    'location': '113.673866,23.644864',\n",
       "    'address': '温泉大道888号',\n",
       "    'poiweight': '0.55295',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFFAIYUL',\n",
       "    'name': '悠然居农庄',\n",
       "    'type': '体育休闲服务;休闲场所;休闲场所',\n",
       "    'tel': '020-87836333',\n",
       "    'direction': '东北',\n",
       "    'distance': '453.658',\n",
       "    'location': '113.674596,23.646622',\n",
       "    'address': '温泉镇卫东村105国道旁(中石油油站斜对面)',\n",
       "    'poiweight': '0.176098',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00141JCE0',\n",
       "    'name': '卫东村委会',\n",
       "    'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '783.685',\n",
       "    'location': '113.677684,23.647884',\n",
       "    'address': '温泉大道与三层街交叉口东北约160米',\n",
       "    'poiweight': '0.0982661',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00141JCP2',\n",
       "    'name': '中共卫东村支部委员会',\n",
       "    'type': '政府机构及社会团体;政府机关;乡镇以下级政府及事业单位',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '791.834',\n",
       "    'location': '113.677733,23.647946',\n",
       "    'address': '温泉大道与三层街交叉路口往东北约180米',\n",
       "    'poiweight': '0.123706',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFLJUBM6',\n",
       "    'name': '浩锋拖车服务有限公司',\n",
       "    'type': '汽车服务;汽车服务相关;汽车服务相关',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '464.566',\n",
       "    'location': '113.666989,23.643103',\n",
       "    'address': '温泉镇福泉路荔品汇方向上坡往前走400米',\n",
       "    'poiweight': '0.172207',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFLJV8JY',\n",
       "    'name': '从化公安24小时自助办证区',\n",
       "    'type': '政府机构及社会团体;公检法机构;公安警察',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '577.938',\n",
       "    'location': '113.665957,23.642598',\n",
       "    'address': [],\n",
       "    'poiweight': '0.266754',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00140SSJ8',\n",
       "    'name': '其兴里',\n",
       "    'type': '地名地址信息;普通地名;村庄级地名',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '670.899',\n",
       "    'location': '113.674968,23.648817',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.300883',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B00140SSJT',\n",
       "    'name': '卫东村',\n",
       "    'type': '地名地址信息;普通地名;村庄级地名',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '791.834',\n",
       "    'location': '113.677733,23.647946',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.281402',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFHI5E3D',\n",
       "    'name': '卫东立交',\n",
       "    'type': '地名地址信息;交通地名;立交桥',\n",
       "    'tel': [],\n",
       "    'direction': '西北',\n",
       "    'distance': '697.827',\n",
       "    'location': '113.665349,23.646438',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.243363',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFL3TNAX',\n",
       "    'name': '从化消防大队温泉站',\n",
       "    'type': '政府机构及社会团体;公检法机构;消防机关',\n",
       "    'tel': [],\n",
       "    'direction': '东北',\n",
       "    'distance': '716.362',\n",
       "    'location': '113.677249,23.647402',\n",
       "    'address': '温泉大道与三层街交叉口东北约100米',\n",
       "    'poiweight': '0.145199',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFIAPQ5C',\n",
       "    'name': '荔品汇(建设中)',\n",
       "    'type': '商务住宅;商务住宅相关;商务住宅相关',\n",
       "    'tel': [],\n",
       "    'direction': '西',\n",
       "    'distance': '899.214',\n",
       "    'location': '113.662855,23.642072',\n",
       "    'address': 'Y526(福泉路)',\n",
       "    'poiweight': '0.163558',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFGSLPVS',\n",
       "    'name': '温泉出口(G45大广高速南向)',\n",
       "    'type': '地名地址信息;交通地名;高速路出口',\n",
       "    'tel': [],\n",
       "    'direction': '西南',\n",
       "    'distance': '992.802',\n",
       "    'location': '113.664404,23.637570',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.209425',\n",
       "    'businessarea': '温泉'},\n",
       "   {'id': 'B0FFGSLOPD',\n",
       "    'name': '温泉收费站(G45大广高速入口)',\n",
       "    'type': '道路附属设施;收费站;收费站',\n",
       "    'tel': [],\n",
       "    'direction': '西南',\n",
       "    'distance': '840.769',\n",
       "    'location': '113.666065,23.637999',\n",
       "    'address': '从化区',\n",
       "    'poiweight': '0.186236',\n",
       "    'businessarea': '温泉'}],\n",
       "  'roads': [{'id': '020F49F0050462451',\n",
       "    'name': '中山路',\n",
       "    'direction': '西南',\n",
       "    'distance': '21.7638',\n",
       "    'location': '113.672,23.6438'},\n",
       "   {'id': '020F49F00504698',\n",
       "    'name': '温泉大道',\n",
       "    'direction': '东南',\n",
       "    'distance': '38.8638',\n",
       "    'location': '113.671,23.644'},\n",
       "   {'id': '020F49F006047765',\n",
       "    'name': 'S29从莞深高速',\n",
       "    'direction': '北',\n",
       "    'distance': '97.7893',\n",
       "    'location': '113.671,23.6428'}],\n",
       "  'roadinters': [{'direction': '南',\n",
       "    'distance': '41.2308',\n",
       "    'location': '113.671429,23.644049',\n",
       "    'first_id': '020F49F0050462451',\n",
       "    'first_name': '中山路',\n",
       "    'second_id': '020F49F00504698',\n",
       "    'second_name': '温泉大道'}],\n",
       "  'aois': []}}"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "71c23f37",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>type</th>\n",
       "      <th>tel</th>\n",
       "      <th>direction</th>\n",
       "      <th>distance</th>\n",
       "      <th>location</th>\n",
       "      <th>address</th>\n",
       "      <th>poiweight</th>\n",
       "      <th>businessarea</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>B0I6BUT5PX</td>\n",
       "      <td>顺通驾校</td>\n",
       "      <td>科教文化服务;驾校;驾校</td>\n",
       "      <td>[]</td>\n",
       "      <td>东</td>\n",
       "      <td>229.992</td>\n",
       "      <td>113.673591,23.644476</td>\n",
       "      <td>温泉大道888号</td>\n",
       "      <td>0.183876</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>B0FFIXZM0P</td>\n",
       "      <td>从化温泉竹园农庄(温泉镇店)</td>\n",
       "      <td>餐饮服务;中餐厅;中餐厅</td>\n",
       "      <td>13650895671</td>\n",
       "      <td>东北</td>\n",
       "      <td>226.766</td>\n",
       "      <td>113.672914,23.645264</td>\n",
       "      <td>温泉镇卫东村105国道旁广州南方学院斜对面</td>\n",
       "      <td>0.205309</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>B0FFG6A3H6</td>\n",
       "      <td>中石油冠力金叶加油站</td>\n",
       "      <td>汽车服务;加油站;中国石油</td>\n",
       "      <td>020-87830698</td>\n",
       "      <td>东北</td>\n",
       "      <td>273.921</td>\n",
       "      <td>113.673866,23.644864</td>\n",
       "      <td>温泉大道888号</td>\n",
       "      <td>0.55295</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B0FFFAIYUL</td>\n",
       "      <td>悠然居农庄</td>\n",
       "      <td>体育休闲服务;休闲场所;休闲场所</td>\n",
       "      <td>020-87836333</td>\n",
       "      <td>东北</td>\n",
       "      <td>453.658</td>\n",
       "      <td>113.674596,23.646622</td>\n",
       "      <td>温泉镇卫东村105国道旁(中石油油站斜对面)</td>\n",
       "      <td>0.176098</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B00141JCE0</td>\n",
       "      <td>卫东村委会</td>\n",
       "      <td>政府机构及社会团体;政府机关;乡镇以下级政府及事业单位</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>783.685</td>\n",
       "      <td>113.677684,23.647884</td>\n",
       "      <td>温泉大道与三层街交叉口东北约160米</td>\n",
       "      <td>0.0982661</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B00141JCP2</td>\n",
       "      <td>中共卫东村支部委员会</td>\n",
       "      <td>政府机构及社会团体;政府机关;乡镇以下级政府及事业单位</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>791.834</td>\n",
       "      <td>113.677733,23.647946</td>\n",
       "      <td>温泉大道与三层街交叉路口往东北约180米</td>\n",
       "      <td>0.123706</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>B0FFLJUBM6</td>\n",
       "      <td>浩锋拖车服务有限公司</td>\n",
       "      <td>汽车服务;汽车服务相关;汽车服务相关</td>\n",
       "      <td>[]</td>\n",
       "      <td>西</td>\n",
       "      <td>464.566</td>\n",
       "      <td>113.666989,23.643103</td>\n",
       "      <td>温泉镇福泉路荔品汇方向上坡往前走400米</td>\n",
       "      <td>0.172207</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>B0FFLJV8JY</td>\n",
       "      <td>从化公安24小时自助办证区</td>\n",
       "      <td>政府机构及社会团体;公检法机构;公安警察</td>\n",
       "      <td>[]</td>\n",
       "      <td>西</td>\n",
       "      <td>577.938</td>\n",
       "      <td>113.665957,23.642598</td>\n",
       "      <td>[]</td>\n",
       "      <td>0.266754</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>B00140SSJ8</td>\n",
       "      <td>其兴里</td>\n",
       "      <td>地名地址信息;普通地名;村庄级地名</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>670.899</td>\n",
       "      <td>113.674968,23.648817</td>\n",
       "      <td>从化区</td>\n",
       "      <td>0.300883</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>B00140SSJT</td>\n",
       "      <td>卫东村</td>\n",
       "      <td>地名地址信息;普通地名;村庄级地名</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>791.834</td>\n",
       "      <td>113.677733,23.647946</td>\n",
       "      <td>从化区</td>\n",
       "      <td>0.281402</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>B0FFHI5E3D</td>\n",
       "      <td>卫东立交</td>\n",
       "      <td>地名地址信息;交通地名;立交桥</td>\n",
       "      <td>[]</td>\n",
       "      <td>西北</td>\n",
       "      <td>697.827</td>\n",
       "      <td>113.665349,23.646438</td>\n",
       "      <td>从化区</td>\n",
       "      <td>0.243363</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>B0FFL3TNAX</td>\n",
       "      <td>从化消防大队温泉站</td>\n",
       "      <td>政府机构及社会团体;公检法机构;消防机关</td>\n",
       "      <td>[]</td>\n",
       "      <td>东北</td>\n",
       "      <td>716.362</td>\n",
       "      <td>113.677249,23.647402</td>\n",
       "      <td>温泉大道与三层街交叉口东北约100米</td>\n",
       "      <td>0.145199</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>B0FFIAPQ5C</td>\n",
       "      <td>荔品汇(建设中)</td>\n",
       "      <td>商务住宅;商务住宅相关;商务住宅相关</td>\n",
       "      <td>[]</td>\n",
       "      <td>西</td>\n",
       "      <td>899.214</td>\n",
       "      <td>113.662855,23.642072</td>\n",
       "      <td>Y526(福泉路)</td>\n",
       "      <td>0.163558</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>B0FFGSLPVS</td>\n",
       "      <td>温泉出口(G45大广高速南向)</td>\n",
       "      <td>地名地址信息;交通地名;高速路出口</td>\n",
       "      <td>[]</td>\n",
       "      <td>西南</td>\n",
       "      <td>992.802</td>\n",
       "      <td>113.664404,23.637570</td>\n",
       "      <td>从化区</td>\n",
       "      <td>0.209425</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>B0FFGSLOPD</td>\n",
       "      <td>温泉收费站(G45大广高速入口)</td>\n",
       "      <td>道路附属设施;收费站;收费站</td>\n",
       "      <td>[]</td>\n",
       "      <td>西南</td>\n",
       "      <td>840.769</td>\n",
       "      <td>113.666065,23.637999</td>\n",
       "      <td>从化区</td>\n",
       "      <td>0.186236</td>\n",
       "      <td>温泉</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            id              name                         type           tel  \\\n",
       "0   B0I6BUT5PX              顺通驾校                 科教文化服务;驾校;驾校            []   \n",
       "1   B0FFIXZM0P    从化温泉竹园农庄(温泉镇店)                 餐饮服务;中餐厅;中餐厅   13650895671   \n",
       "2   B0FFG6A3H6        中石油冠力金叶加油站                汽车服务;加油站;中国石油  020-87830698   \n",
       "3   B0FFFAIYUL             悠然居农庄             体育休闲服务;休闲场所;休闲场所  020-87836333   \n",
       "4   B00141JCE0             卫东村委会  政府机构及社会团体;政府机关;乡镇以下级政府及事业单位            []   \n",
       "5   B00141JCP2        中共卫东村支部委员会  政府机构及社会团体;政府机关;乡镇以下级政府及事业单位            []   \n",
       "6   B0FFLJUBM6        浩锋拖车服务有限公司           汽车服务;汽车服务相关;汽车服务相关            []   \n",
       "7   B0FFLJV8JY     从化公安24小时自助办证区         政府机构及社会团体;公检法机构;公安警察            []   \n",
       "8   B00140SSJ8               其兴里            地名地址信息;普通地名;村庄级地名            []   \n",
       "9   B00140SSJT               卫东村            地名地址信息;普通地名;村庄级地名            []   \n",
       "10  B0FFHI5E3D              卫东立交              地名地址信息;交通地名;立交桥            []   \n",
       "11  B0FFL3TNAX         从化消防大队温泉站         政府机构及社会团体;公检法机构;消防机关            []   \n",
       "12  B0FFIAPQ5C          荔品汇(建设中)           商务住宅;商务住宅相关;商务住宅相关            []   \n",
       "13  B0FFGSLPVS   温泉出口(G45大广高速南向)            地名地址信息;交通地名;高速路出口            []   \n",
       "14  B0FFGSLOPD  温泉收费站(G45大广高速入口)               道路附属设施;收费站;收费站            []   \n",
       "\n",
       "   direction distance              location                 address  \\\n",
       "0          东  229.992  113.673591,23.644476                温泉大道888号   \n",
       "1         东北  226.766  113.672914,23.645264   温泉镇卫东村105国道旁广州南方学院斜对面   \n",
       "2         东北  273.921  113.673866,23.644864                温泉大道888号   \n",
       "3         东北  453.658  113.674596,23.646622  温泉镇卫东村105国道旁(中石油油站斜对面)   \n",
       "4         东北  783.685  113.677684,23.647884      温泉大道与三层街交叉口东北约160米   \n",
       "5         东北  791.834  113.677733,23.647946    温泉大道与三层街交叉路口往东北约180米   \n",
       "6          西  464.566  113.666989,23.643103    温泉镇福泉路荔品汇方向上坡往前走400米   \n",
       "7          西  577.938  113.665957,23.642598                      []   \n",
       "8         东北  670.899  113.674968,23.648817                     从化区   \n",
       "9         东北  791.834  113.677733,23.647946                     从化区   \n",
       "10        西北  697.827  113.665349,23.646438                     从化区   \n",
       "11        东北  716.362  113.677249,23.647402      温泉大道与三层街交叉口东北约100米   \n",
       "12         西  899.214  113.662855,23.642072               Y526(福泉路)   \n",
       "13        西南  992.802  113.664404,23.637570                     从化区   \n",
       "14        西南  840.769  113.666065,23.637999                     从化区   \n",
       "\n",
       "    poiweight businessarea  \n",
       "0    0.183876           温泉  \n",
       "1    0.205309           温泉  \n",
       "2     0.55295           温泉  \n",
       "3    0.176098           温泉  \n",
       "4   0.0982661           温泉  \n",
       "5    0.123706           温泉  \n",
       "6    0.172207           温泉  \n",
       "7    0.266754           温泉  \n",
       "8    0.300883           温泉  \n",
       "9    0.281402           温泉  \n",
       "10   0.243363           温泉  \n",
       "11   0.145199           温泉  \n",
       "12   0.163558           温泉  \n",
       "13   0.209425           温泉  \n",
       "14   0.186236           温泉  "
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.json_normalize(r.json()['regeocode']['pois'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27df4c4c",
   "metadata": {},
   "source": [
    "## 作业：\n",
    " \n",
    "> 1. 尝试搜索poi2.0接口\n",
    "> 2. 获取中餐厅、西餐厅、快餐厅（图片、内容等...）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f472b8c5",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7f3a0ab7",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "040a4549",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b858604f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "edf948bb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
